<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title> - 登录</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico"> <link href="__PUBLIC__/Admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/Admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">

    <link href="__PUBLIC__/Admin/css/animate.css" rel="stylesheet">
    <link href="__PUBLIC__/Admin/css/style.css?v=4.1.0" rel="stylesheet">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <script>if(window.top !== window.self){ window.top.location = window.location;}</script>
</head>

<body class="gray-bg">

    <div class="middle-box text-center loginscreen  animated fadeInDown">
        <div>
            <div>

                <h1 class="logo-name">h</h1>

            </div>
            <h3>欢迎使用 hAdmin</h3>

            <form class="m-t" role="form" id="form" action="{:U('Login/checkLogin')}" method="post">
                <div class="form-group">
                    <input type="text" class="form-control" placeholder="用户名" name="username">
                </div>
                <div class="form-group">
                    <input type="password" class="form-control" placeholder="密码" name="password" >
                </div>
                <div class="form-group">
                    <input type="text" class="form-control" placeholder="验证码"  name="code">
                    <span >
                       <img src="{:U('Verify/verify')}" onclick="chage()" id="verifyImg" style="margin-top: 10px">
                       <script>
                         function chage(){
                        	 $("#verifyImg").attr("src","{:U('Verify/verify')}")
                         }
                       </script>
                    </span>
                </div>
                <button type="button" onclick="login()" class="btn btn-primary block full-width m-b">登 录</button>

                <!-- 
                    <p class="text-muted text-center"> <a href="login.html#"><small>忘记密码了？</small></a> | <a href="register.html">注册一个新账号</a>
                -->
                </p>

            </form>
        </div>
    </div>
    <!-- 全局js -->
    <script src="__PUBLIC__/Admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="__PUBLIC__/Admin/js/bootstrap.min.js?v=3.3.6"></script>
    <!--layer弹框-->
    <script src="__PUBLIC__/layer/layer.js"></script>
    <script>
      
     function login(){
           var code     = $("#form input[name='code']").val();
           var username = $("#form input[name='username']").val();
           var password = $("#form input[name='password']").val();
           $.ajax({
            url     :"{:U('Login/checkLogin')}",
            data    :{code:code,username:username,password:password},
            dataType:'json',
            type    :'post',
            success :function(res){
                if(res.status == 1){
                   layer.msg(res.info,{time:2000},function(){
                    location.href  = "{:U('Index/index')}";
                   });
                }else{
                    layer.msg(res.info,{time:1000},function(){
                    $("#verifyImg").attr("src","{:U('Verify/verify')}");
                   });
                }
            }
           })
     }
       
    </script>
    

</body>

</html>
